package com.example.zyxdemo.consumer;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.UUID;

/**
 * @version: 1.00.00
 * @desctiption:
 * @company: 厦门立林科技有限公司
 * @author: zhangyx
 * @create: 2023/1/11 8:38
 **/
@Component
@Slf4j
public class DeviceOnOffConsumer2 {

//    @KafkaListener(topics = {"zyx_test"}, containerFactory = "otaKafkaBatchListener")
    public void consumerListener(List<ConsumerRecord<String, String>> messages, Acknowledgment ack) {
        String uuid = UUID.randomUUID().toString();
        for (ConsumerRecord<String, String> req : messages) {
            log.info("uuid：{}线程：{}消费消息分区：{}：{}",uuid,Thread.currentThread().getName(), req.partition(), req.value());
        }
        ack.acknowledge();
    }

}